#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../kv.h"
static kv_pair *add(kv_pair **kv) {
    //test static constant
    *kv=kv_add(*kv,"key","value");

    //test stack var and constant
    char k[4]="key\0";
    char v[6]="value\0";
    *kv=kv_add(*kv,k,v);

    //test stack var and static constant 
    char *k3="key";
    char *v3="value";
    *kv=kv_add(*kv,k3,v3);

    //test heap 
    char *k4=malloc(4);
    char *v4=malloc(6);
    strcpy(k4,"key\0");
    strcpy(v4,"value\0");
    *kv=kv_add(*kv,k4,v4);
    free(k4);
    free(v4);
}
int main () {
    kv_pair *kv=NULL;
    add(&kv);

    //test stack var and constant
    char k[4]="key\0";
    char v[6]="value\0";

    kv=kv_add(kv,k,v);
    while (kv) {
        assert(!strcmp("key",kv->key));
        assert(!strcmp("value",kv->value));
        kv=kv->next;
    }
    return 0;
}
